package xyz.hujf.otherbase.lock.可重入锁;

import org.junit.Test;

/**
 * @author Hujf
 * @title: Hello
 * @date 2021-04-27 14:20
 * @description: TODO
 */
public class Hello {

    public synchronized void helloA(){
        System.out.println("hello a");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public synchronized void helloB(){
        System.out.println("hello b");
        helloA();
    }

    @Test
    public void test(){
        helloA();
        helloB();
    }
}
